import numpy as np
import cv2

g_camera = cv2.VideoCapture(0)
g_camera.set(3, 640)
g_camera.set(4, 480)
g_camera.set(5, 30)  #设置帧率
g_camera.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter.fourcc('M', 'J', 'P', 'G'))
g_camera.set(cv2.CAP_PROP_BRIGHTNESS, 100) #设置亮度
g_camera.set(cv2.CAP_PROP_CONTRAST, 50) #设置对比度
g_camera.set(cv2.CAP_PROP_EXPOSURE, 156) #设置曝光值

while (1):
    ret,frame = g_camera.read()
    cv2.imshow("gesture recognition",frame)
    if cv2.waitKey(1) == ord("q"):
        break

g_camera.release()
cv2.destroyAllWindows()